<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

/**
* Classe che descrive la tabelle astratta degli immobili
*
* Totem Immobili descrive tutte le variabili di un immobile 
* Vi saranno descritti metodi di ricerca, inserimento, e cancellazione sul atabase
* 
* @package        Joomla
* @subpackage     Componente TotemToo
* @since          0.2
*/

class admin_TotemToo_Immobili {

	function converti_codice($numero) {
		$n_caratteri = strlen(strval($numero));
		$stringa = '';
		for($i=0; $i < 10 - $n_caratteri; $i++)    {
			$stringa = $stringa.'0';
    		}
		return $stringa.strval($numero);
	}

	function url_richiesta($codice = 0) {
		global $mainframe;
		$site =  $mainframe->getCfg('live_site');
		$temp = $site."index.php?option=com_totemtoo&richiesta=".converti_codice($codice);
		return $temp;
	}	

	function write_image($titolo, $descrizione, $codice) {
		$temp = "<div class='imageElement'>";
		$temp = $temp."<h3>".$titolo."</h3>";
		$temp = $temp."<p>".$descrizione."</p>";
		$temp = $temp."<a href=' ' title='".$descrizione." class='open'></a>";
		$temp = $temp."<img src='media/com_totem/images/".$codice.".jpg' class='full' />";
		$temp = $temp."<img src='media/com_totem/images/".$codice."-mini.jpg' class='thumbnail' />";
		$temp = $temp."</div>";
		return $temp;
	}

	function add_script($titolo, $tipo = Null) {
		// Inserisce gli stili css sul documento
		$document = & JFactory::getDocument();
		switch ($tipo)  {
		 case 'galley':
			$document->addStyleSheet($site.'components/com_totemtoo/css/jd.gallery.css');
			// Inserisce Gli script js sul documento
			$document->addScript($site.'components/com_totemtoo/scripts/mootools.v1.11.js');
			$document->addScript($site.'components/com_totemtoo/scripts/jd.gallery.js');
			$document->addScript($site.'components/com_totemtoo/scripts/jd.gallery.transitions.js');
			break;
		 case 'keyboard':
			$document = & JFactory::getDocument();
			$document->addStyleSheet($site.'components/com_totemtoo/css/keyboard.css');
			// Inserisce Gli script js sul documento per la tastiera
			$document->addScript($site.'components/com_totemtoo/scripts/keyboard.js');
			break;
		 default:
			$document->setTitle($titolo);
			break;
		}
	}

	function show($modo) {
		// make mainframe variable available
	//	global $mainframe;
		// global $JApplication;
		$site =  JApplication::getCfg('live_site');
	$site='/www/';
		// Load the moo.fx scripts
		$document = & JFactory::getDocument();
		

		$document->addStyleSheet($site.'/components/com_totem/css/jd.gallery.css');
		// Add the js-files for image
		$document->addScript($site.'/components/com_totem/scripts/mootools.v1.11.js');
		$document->addScript($site.'/components/com_totem/scripts/jd.gallery.js');
		$document->addScript($site.'/components/com_totem/scripts/jd.gallery.transitions.js');
		

	

	?>

	<script type="text/javascript">
			function startGallery() {
				var myGallery = new gallery($('myGallery'), {
					timed: true,
					defaultTransition: "continuoushorizontal"
				});
			}
			window.onDomReady(startGallery);
		</script>
		<div class="content">
			<div id="myGallery">

			<?
				write_image("titolo","descrizione casa","001001");

			?>
				
			</div>
		</div>
<?
	}
}
?>

